package state;

import state.AlunoState;

public class StateFactory {

    public static AlunoState create(String alunoState) {
        AlunoState actionObject = null;
        String nomeClasse = "state." + alunoState + "State";
        Class classe = null;
        Object object = null;
        try {
            classe = Class.forName(nomeClasse);
            object = classe.newInstance();
        } catch (Exception ex) {
            return null;
        }
        if (!(object instanceof AlunoState)) {
            return null;
        }
        actionObject = (AlunoState) object;
        return actionObject;
    }
}
